var fans = {
	insertFans:function(req, uName, FID, callback){

		req.users.update({'name':uName},{$addToSet:{'Fans':req.dbid(FID)}},
			function(err, result){
				callback('ok')
			}
		)
			
	},
	findFans:function(req, uID, callback){
		req.users.findById(uID, function(err, result){
			if (err) {
				callback('bad request')
			} else {
				callback(result)
			}
		})
	},
	removeFans:function(req,uName,FID,callback){
		req.users.update({'name':uName},{$pull:{'Fans':req.dbid(FID)}
			},function(err, result){
				callback('ok')
			}
		)
				
	},
	existFans:function(req,uID,FID,callback){
		req.users.find({'_id':req.dbid(uID),'Fans':FID}).toArray(function(err,items) {
			if (err) {
				callback('bad request')
			} else {
				callback(items)
			}
		})
	},
}
module.exports = fans;